{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
	<h3 class="pb-3">编辑用户信息</h3>
	<table class="layui-table layui-table-form">
		<tr>
			<td class="layui-td-gray">用户等级<font>*</font></td>
			<td>
				<input type="hidden" name="id" value="{$user.id}">
				<select name="level" lay-verify="required" lay-reqText="请选择用户等级">
				<option value="">请选择用户等级</option>
				{volist name="levels" id="v"}
				<option value="{$v.id}" {eq name="$user.level" value="$v.id"}selected{/eq}>{$v.title}</option>
				{/volist}
			  </select>
			</td>
			<td class="layui-td-gray">用户昵称<font>*</font></td>
			<td>
				<input type="text" name="nickname" placeholder="请输入用户昵称"	autocomplete="off" class="layui-input" value="{$user.nickname}" lay-verify="required" lay-reqText="请输入用户昵称">
			</td>
			<td class="layui-td-gray">真实姓名</td>
			<td>
				<input type="text" name="name" placeholder="请输入真实姓名"	autocomplete="off" class="layui-input" value="{$user.name}">
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">性别</td>
			<td>
				<input type="radio" name="sex" value="1" title="男" {eq name="$user.sex" value="1" }checked{/eq}>
				<input type="radio" name="sex" value="2" title="女" {eq name="$user.sex" value="2" }checked{/eq}>
			</td>
			<td class="layui-td-gray">手机号码</td>
			<td>
				<input type="text" name="mobile" placeholder="请输入手机"	autocomplete="off" class="layui-input" value="{$user.mobile}">
			</td>
			<td class="layui-td-gray">电子邮箱</td>
			<td>
				<input type="text" name="email" placeholder="请输入电子邮箱" autocomplete="off" class="layui-input" value="{$user.email}">
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">个人简介</td>
			<td colspan="5">
				<textarea name="desc" placeholder="请输入个人简介" class="layui-textarea">{$user.desc}</textarea>
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">所在企业</td>
			<td>
				<input type="text" name="company" placeholder="请输入所在企业"	autocomplete="off" class="layui-input" value="{$user.company}">
			</td>
			<td class="layui-td-gray">所在部门</td>
			<td>
				<input type="text" name="depament" placeholder="请输入所在部门"	autocomplete="off" class="layui-input" value="{$user.depament}">
			</td>
			<td class="layui-td-gray">所在职位</td>
			<td>
				<input type="text" name="position" placeholder="请输入所在职位" autocomplete="off" class="layui-input" value="{$user.position}">
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">企业地址</td>
			<td colspan="5">
				<input type="text" name="address" placeholder="请输入企业地址" autocomplete="off" class="layui-input" value="{$user.address}">
			</td>
		</tr>
	</table>

	<div class="py-3">
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool'];
	function gouguInit() {
		var tool = layui.tool, form = layui.form;
		//监听提交
		form.on('submit(webform)', function (data) {
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					parent.layui.tool.close(1000);					
				}
			}
			tool.post("/admin/user/edit", data.field, callback);
			return false;
		});
	}
</script>
{/block}
<!-- /脚本 -->